package com.evenmo.test;

import org.apache.ibatis.session.SqlSession;
import org.junit.Before;
import org.junit.Test;

import com.evenmo.mapper.PersonMapper;
import com.evenmo.pojo.Person;
import com.evenmo.util.MySqlSessionFactory;

public class MybatisTest1 {
	private SqlSession session;
	private PersonMapper personDao;
	private Person p;
	@Before
	public void initDatas() {
		session=getSqlSession();
		personDao=session.getMapper(PersonMapper.class);
		p=new Person();
	}
	
	@Test
	public void testQueryByPersonId() {
		p.setId(1);
		Person person = personDao.queryByPersonId(p);
		System.out.println(person);
	}

	public static SqlSession getSqlSession() {
		return MySqlSessionFactory.getSqlSession();
	}

}
